<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class User_infos extends CI_Model{

	public function __construct(){
		parent::__construct();
		$this->load->database();
	}


	public function getUserInfos($tid){
		if(!$tid) return ;
		$where = array('tid'=>$tid);
		$result = $this->db->get_where('user_infos',$where)->row_array();
		if(isset($result['iid'])) unset($result['iid']);
		if(isset($result['tid'])) unset($result['tid']);
		if(isset($result['version'])) unset($result['version']);
		
		// var_dump($this->config->item('s3_base_url'). $result['pic']);
		if(isset($result['userinfo'])){
			$info = json_decode($result['userinfo']);
			if(isset($result['pic']) && $result['pic']){
				$info->pic = $this->config->item('s3_base_url').$result['pic'];
				unset($result['pic']);
			} else {
				$info->pic = "no";
			}
			// var_dump($info);
			$result['userinfo'] = $info;

		}
		// var_dump($result);
		// var_dump($result);die;
		return $result;
	}


}


		
 ?>